
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>jsSelector</title>
    <style>
        #box1 {
            width: 100px;
            height: 100px;
            background-color: blue;
        }
        #box2 {
            width: 100px;
            height: 100px;
            background-color: red;
        }
    </style>
</head>
<body>

<div id="box1"></div>
<div id="box2"></div>
<div class="box">.box</div>
<div class="box">.box</div>
<input type="text" name="username">


<script src="../vendor/jquery-1.12.4.js"></script>
<script>
    $(function () {
//        var element1 = document.getElementById('box1');
//        var element2 = document.getElementById('box2');
//        var element3 = document.getElementsByClassName('box');
//        var element4 = document.getElementsByName('username');
//        var element5 = document.getElementsByTagName('div');
//
//        console.log(element1);
//        console.log(element2);
//        console.log(element3);
//        console.log(element4);
//        console.log(element5);


        var element6 = document.querySelector('.box');
        var element7 = document.querySelectorAll('.box');
        console.log(element6);
        console.log(element7);
        //内容选择器
        //empty
        //contains(text)
        //has(selector)
        //parent
    });
</script>
</body>
</html>